/**
 * Created with CLion.
 * Description: 
 * User: loong
 * Date: 2024/8/30
 * Time: 22:00
 */
#include <QtWidgets>
#include <grpcpp/grpcpp.h>
#include "Server.h"
#include "GroupService.h"
void GrpcServer()
{
    std::string server_address("0.0.0.0:50051");
    GroupService service;

    grpc::ServerBuilder builder;
    builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
    builder.RegisterService(&service);
    std::unique_ptr<grpc::Server> server(builder.BuildAndStart());
    std::cout << "Server listening on " << server_address << std::endl;

    server->Wait();
}

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    std::thread thread(GrpcServer);

    Server server;
    server.Run();

    thread.join();

    return a.exec();
}